﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;

using Newtonsoft.Json;

namespace SusicoTraderCSharp {
    public class EventBase    {
	 	public static DateTime StartUpTime { get; private set; }
		public static ulong NextSerialId { get; private set; }

		public ulong SerialId { get; private set; }
		public DateTime TimeStamp { get; private set; }
		public TimeSpan TimeFromStart { get; private set; }

		[MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
		static EventBase() {
			StartUpTime = DateTime.Now;
			NextSerialId = 0;
		}

		[MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
		public EventBase() {
			TimeStamp = DateTime.Now;
			TimeFromStart = StartUpTime - TimeStamp;
			SerialId = NextSerialId++;
		}

		[MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
		public override string ToString() {
			return JsonConvert.SerializeObject(this);
		}
    }
}
